#ifndef ADVKRENDERPASS_H
#define ADVKRENDERPASS_H

#include "Graphic/AdVKCommon.h"

namespace ade{
    class AdVKDevice;
    class AdVKFrameBuffer;

    struct Attachment{
        int32_t ref = -1;
        VkImageLayout layout = VK_IMAGE_LAYOUT_UNDEFINED;
    };

    struct RenderSubPass{
        Attachment inputAttachment;
        Attachment colorAttachment;
        Attachment depthStencilAttachment;
        Attachment resolveAttachment;
    };

    class AdVKRenderPass{
    public:
        AdVKRenderPass(AdVKDevice *device, const std::vector<VkAttachmentDescription> &attachments = {}, const std::vector<RenderSubPass> &subPasses = {});
        ~AdVKRenderPass();

        VkRenderPass GetHandle() const { return mHandle; }

        void Begin(VkCommandBuffer cmdBuffer, AdVKFrameBuffer *frameBuffer, const std::vector<VkClearValue> &clearValues) const;
        void End(VkCommandBuffer cmdBuffer) const;
    private:
        VkRenderPass mHandle = VK_NULL_HANDLE;
        AdVKDevice *mDevice;

        std::vector<VkAttachmentDescription> mAttachments;
        std::vector<RenderSubPass> mSubPasses;
    };
}

#endif